var time = function (time) {
    if (!time) {
        return ''
    }
    const dateTime = new Date(time);

    const year = dateTime.getFullYear();
    const month = dateTime.getMonth() + 1;
    const data = dateTime.getDate() ;
    const hour = dateTime.getHours();
    const minute = dateTime.getMinutes();
    const second = dateTime.getSeconds();

    function addZero(v) {
        return v < 10 ? '0' + v : v
    }
        // eslint-disable-next-line no-redeclare
        var times=`${year}-${addZero(month)}-${addZero(data)} ${addZero(hour)}:${addZero(minute)}:${addZero(second)}`
    
    return times
}

export default time